package News.servlet;


import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import News.entity.Question;

public class showServlet extends HttpServlet {
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        request.setCharacterEncoding("UTF-8");
        response.setCharacterEncoding("UTF-8");

        String nickName=(String)request.getParameter("nickName");
        String city=(String)request.getParameter("city");
        String[]language=(String[])request.getParameterValues("language");

        System.out.println(nickName+"\n"+city);
        for(String s:language){
            System.out.print(s+"\t");
        }

        Question q=new Question();
        q.setNickName(nickName);
        q.setCity(city);
        q.setLanguage(language);

        request.setAttribute("question",q);

        request.getRequestDispatcher("Question/show.jsp").forward(request,response);
    }
}
